import 'package:dio/dio.dart';

class Sev{
  // static String apiUrl = 'https://api-app.yiniumall.com/';
  static String apiUrl = 'https://api.currydc.com/';
  // String token = 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxMzEyMDc3MzE4OCIsImNyZWF0ZWQiOjE1NzM1MzY3ODQ5NzgsImV4cCI6MTU3NDE0MTU4NH0.0IP2bjmgw71QJuegqbp3ixBQ9R3Rd5oxj49ELOeaw9YlxD_xvhjA5HLD1BAjLaPvxtMFcOiYw_qboBCM9y-wbg';
  // static String appKey = 'aec025fb97f74a73fac3a8b21d43def2';//UangLaLa
  static String appKey = '108bf3cbc41eabe6b61f843f99756e08';//DanaBudi
  // static String appKey = '86ece1ef61ed555aeac9437291791fee';//Uangkupinjam

  Future<dynamic> post(String api,{dynamic data}) async {
    // Map<String, dynamic> headers = new Map();
    // headers['authorization'] = token;
    try {
      print('url =======' + '$apiUrl$api');
      print('data =======' + '$data');
      var result = await Dio().post(apiUrl+api,
          data: data,
          // options: Options(headers: headers) 
      );
      return result.data;
    } catch (e) {
      return {'code': 500};
    }
  }

  Future<dynamic> get(String api,{dynamic params}) async {
    // Map<String, dynamic> headers = new Map();
    // headers['authorization'] = token;
    try {
      print('url =======' + '$apiUrl$api');
      // ${api.contains('?')?'&':'?'}t=' + DateTime.now().toString()
      var result = await Dio().get('$apiUrl$api');
      return result.data;
    } catch (e) {
      return {'code': 500};
    }
  }
}